
********************************************************************************
**** Covid-19 Crisis and Hostility against Foreigners 
**** Multiple hypothesis testing
**** Code runs for several hours (depending on computing power used)
*******************************************************************************

log using "$logpath/04_mht", replace


***************************************************************************************************
** Multiple hypothesis testing correction for Supplementary Tables 2 and S3 - 2 hypotheses ((i) behavior towards foreigners and (ii) behavior towards domestic out-group members)
***************************************************************************************************
{
use "$cleandatapath/covid_fuels_hostility_clean_long.dta", clear

encode type_group, gen(type_group_num)
tab type_group_num
tab type_group_num, nolabel
encode type_index, gen(type_index_num)
tab type_index_num
tab type_index_num, nolabel

* Panel A: Baseline controls
* Version of mhtreg at the time of running was not able to handle strings in "if" commands
mhtreg ///
	(HHT covid_prime $basic_controls if type_index_num==4) ///
	(HHT covid_prime $basic_controls if type_index_num==3) ///
	, bootstrap(10000) cluster(respondentId) cltype(3)

* Panel B: No controls
mhtreg ///
	(HHT covid_prime  if type_index_num==4) ///
	(HHT covid_prime  if type_index_num==3) ///
	, bootstrap(10000) cluster(respondentId) cltype(3)
	
* Panel C: Additional controls
mhtreg ///
	(HHT covid_prime $basic_controls $additional_controls if type_index_num==4) ///
	(HHT covid_prime $basic_controls $additional_controls if type_index_num==3) ///
		, bootstrap(10000) cluster(respondentId) cltype(3)	
}

***************************************************************************************************
** Multiple hypothesis testing correction for Supplementary Tables 2 and S3 - 17 hypotheses (the most conservative approach)
***************************************************************************************************
{
use "$cleandatapath/covid_fuels_hostility_clean_long.dta", clear

encode type_group, gen(type_group_num)
tab type_group_num
tab type_group_num, nolabel
encode type_index, gen(type_index_num)
tab type_index_num
tab type_index_num, nolabel

* Panel A: Baseline controls
* Version of mhtreg at the time of running was not able to handle strings in "if" commands
mhtreg ///
	(HHT covid_prime $basic_controls if type_index_num==1) ///
	(HHT covid_prime $basic_controls if type_index_num==4) ///
	(HHT covid_prime $basic_controls if type_group_num==2) ///
	(HHT covid_prime $basic_controls if type_group_num==4) ///
	(HHT covid_prime $basic_controls if type_group_num==14) ///
	(HHT covid_prime $basic_controls if type_group_num==1) ///
	(HHT covid_prime $basic_controls if type_index_num==2) ///
	(HHT covid_prime $basic_controls if type_index_num==3) ///
	(HHT covid_prime $basic_controls if type_group_num==9) ///
	(HHT covid_prime $basic_controls if type_group_num==10) ///
	(HHT covid_prime $basic_controls if type_group_num==7) ///
	(HHT covid_prime $basic_controls if type_group_num==8) ///
	(HHT covid_prime $basic_controls if type_group_num==6) ///
	(HHT covid_prime $basic_controls if type_group_num==13) ///
	(HHT covid_prime $basic_controls if type_group_num==5) ///
	(HHT covid_prime $basic_controls if type_group_num==11) ///
	(HHT covid_prime $basic_controls if type_group_num==12) ///
	, bootstrap(10000) cluster(respondentId) cltype(3)


* Panel B: No controls
mhtreg ///
	(HHT covid_prime  if type_index_num==1) ///
	(HHT covid_prime  if type_index_num==4) ///
	(HHT covid_prime  if type_group_num==2) ///
	(HHT covid_prime  if type_group_num==4) ///
	(HHT covid_prime  if type_group_num==14) ///
	(HHT covid_prime  if type_group_num==1) ///
	(HHT covid_prime  if type_index_num==2) ///
	(HHT covid_prime  if type_index_num==3) ///
	(HHT covid_prime  if type_group_num==9) ///
	(HHT covid_prime  if type_group_num==10) ///
	(HHT covid_prime  if type_group_num==7) ///
	(HHT covid_prime  if type_group_num==8) ///
	(HHT covid_prime  if type_group_num==6) ///
	(HHT covid_prime  if type_group_num==13) ///
	(HHT covid_prime  if type_group_num==5) ///
	(HHT covid_prime  if type_group_num==11) ///
	(HHT covid_prime  if type_group_num==12) ///
	, bootstrap(10000) cluster(respondentId) cltype(3)
	
* Panel C: Additional controls
mhtreg ///
	(HHT covid_prime $basic_controls $additional_controls if type_index_num==1) ///
	(HHT covid_prime $basic_controls $additional_controls if type_index_num==4) ///
	(HHT covid_prime $basic_controls $additional_controls if type_group_num==2) ///
	(HHT covid_prime $basic_controls $additional_controls if type_group_num==4) ///
	(HHT covid_prime $basic_controls $additional_controls if type_group_num==14) ///
	(HHT covid_prime $basic_controls $additional_controls if type_group_num==1) ///
	(HHT covid_prime $basic_controls $additional_controls if type_index_num==2) ///
	(HHT covid_prime $basic_controls $additional_controls if type_index_num==3) ///
	(HHT covid_prime $basic_controls $additional_controls if type_group_num==9) ///
	(HHT covid_prime $basic_controls $additional_controls if type_group_num==10) ///
	(HHT covid_prime $basic_controls $additional_controls if type_group_num==7) ///
	(HHT covid_prime $basic_controls $additional_controls if type_group_num==8) ///
	(HHT covid_prime $basic_controls $additional_controls if type_group_num==6) ///
	(HHT covid_prime $basic_controls $additional_controls if type_group_num==13) ///
	(HHT covid_prime $basic_controls $additional_controls if type_group_num==5) ///
	(HHT covid_prime $basic_controls $additional_controls if type_group_num==11) ///
	(HHT covid_prime $basic_controls $additional_controls if type_group_num==12) ///
	, bootstrap(10000) cluster(respondentId) cltype(3)	
}

log close
